//
//  STUIAppearance.swift
//  iPhone
//
//  Created by Toj on 6/9/22.
//

import UIKit
import TTCOM_iOS

open class STUIAppearance {
    
    static let shared = STUIAppearance()
    
    private var preparings: [STPreparingProtocol.Type] = {
        var ps: [STPreparingProtocol.Type] = [
            UIButton.self
        ]
        return ps
    }()
    
    public func setup() {
        scrollViewAppearance()
        
        tableViewAppearance()
        
        preparsAppearance()
    }
    
    private func scrollViewAppearance() {
        UIScrollView.appearance().contentInsetAdjustmentBehavior = .never
    }
    
    private func tableViewAppearance() {
        if #available(iOS 15.0, *) {
            UITableView.appearance().sectionHeaderTopPadding = 0.01
        }
    }
    
    private func preparsAppearance() {
        preparings.forEach { $0.preparInitialize() }
    }
}
